package com.cnswhy.cloud.server.core.dao;

import com.cnswhy.cloud.common.core.base.mapper.SuperMapper;
import com.cnswhy.cloud.server.core.entity.ShopSpecValue;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * 规格值表
 * </p>
 *
 * @author cnswhy
 * @date 2020-11-07
 */
@Repository
public interface ShopSpecValueMapper extends SuperMapper<ShopSpecValue> {
    @Select("select * from t_shop_spec_value where spec_id = #{specId} and (type = 1 or product_id = #{productId}) order by sort_order")
    List<ShopSpecValue> querySpecValueList(@Param("productId") Long productId, @Param("specId") Long specId);
    @Select("select \n" +
            "   * \n" +
            "from \n" +
            "   t_shop_spec_value \n" +
            "where spec_id = #{specId}\n" +
            " and type = 1\n" +
            "order by sort_order")
    List<ShopSpecValue> querySpecValueListBySpecId(@Param("specId") Long specId);
}
